Natural resources, such as oil or gas, residing in a subterranean formation can be recovered by drilling a wellbore that penetrates the formation. A variety of fluids are used in both drilling and completing the wellbore and in resource recovery. Each of these fluids may serve different purposes within a wellbore. During the drilling of the wellbore, for example, a drilling fluid may be used to, among other things, cool the drill bit, lubricate the rotating drill string to prevent it from sticking to the walls of the wellbore, prevent blowouts by serving as a hydrostatic head to the entrance into the wellbore of formation fluids, and remove drill cuttings from the wellbore.